/**
 * WorkOrderDaoImpl.java
 * Created at 2017-11-22
 * Created by zhanghailin
 * Copyright (C) 2017 BROADTEXT SOFTWARE, All rights reserved.
 */
package com.broadtext.rms.system.dao.impl;

import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.broadtext.common.exp.DaoException;
import com.broadtext.common.repository.EntityDao;
import com.broadtext.rms.system.dao.IWorkOrderDao;
import com.broadtext.rms.system.model.TmWorkOrder;

/**
 * <p>ClassName: WorkOrderDaoImpl</p>
 * <p>Description: TODO</p>
 * <p>Author: zhanghailin</p>
 * <p>Date: 2017-11-22</p>
 */
@Repository("workOrderDao")
public class WorkOrderDaoImpl extends EntityDao<TmWorkOrder> implements IWorkOrderDao{

    /** (non-Javadoc)
     * <p>Title: getServicePlanCount</p>
     * <p>Description: </p>
     * @param params
     * @return
     * @see com.broadtext.rms.system.dao.IWorkOrderDao#getServicePlanCount(java.util.Map)
     */
    @Override
    public long getServicePlanCount(Map<String, Object> params) {
        long count = 0;
        try {
            SqlSession session = this.getCurrentSession();
            count = session.selectOne("com.broadtext.rms.system.model.TmWorkOrder.getServicePlanCount",params);
            session.close();
        } catch (DaoException e) {
            e.printStackTrace();
            return 0;
        }
        return count;
    }

    /** (non-Javadoc)
     * <p>Title: getServiceRequestCount</p>
     * <p>Description: </p>
     * @param params
     * @return
     * @see com.broadtext.rms.system.dao.IWorkOrderDao#getServiceRequestCount(java.util.Map)
     */
    @Override
    public long getServiceRequestCount(Map<String, Object> params) {
        long count = 0;
        try {
            SqlSession session = this.getCurrentSession();
            count = session.selectOne("com.broadtext.rms.system.model.TmWorkOrder.getServiceRequestCount",params);
            session.close();
        } catch (DaoException e) {
            e.printStackTrace();
            return 0;
        }
        return count;
    }

}
